﻿using System;
using System.Runtime.Serialization;

namespace Hxsoft.AppV1
{
	public class ObjectExistsException : Exception
	{
		public ObjectExistsException()
		{
		}

		public ObjectExistsException(string message)
			: base(message)
		{
		}

		protected ObjectExistsException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public ObjectExistsException(string message, Exception inner)
			: base(message, inner)
		{
		}
	}

	public class ObjectNotExistsException : Exception
	{
		public ObjectNotExistsException()
		{
		}

		public ObjectNotExistsException(string message)
			: base(message)
		{
		}

		protected ObjectNotExistsException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public ObjectNotExistsException(string message, Exception inner)
			: base(message, inner)
		{
		}
	}

	public class DataException : Exception
	{
		public DataException()
		{
		}

		public DataException(string message)
			: base(message)
		{
		}

		protected DataException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public DataException(string message, Exception inner)
			: base(message, inner)
		{
		}
	}

	public class OperationException : Exception
	{
		public OperationException()
		{
		}

		public OperationException(string message)
			: base(message)
		{
		}

		protected OperationException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public OperationException(string message, Exception inner)
			: base(message, inner)
		{
		}
	}

	public class PermissionException : Exception
	{
		public string OperateUserName { get; private set; }
		public object OperateObject { get; private set; }
		public Guid OperationResourceId { get; private set; }
		public int OperationPermissionCode { get; private set; }

		public PermissionException()
		{
		}

		public PermissionException(string message)
			: base(message)
		{
		}

		protected PermissionException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
		}

		public PermissionException(string message, Exception inner)
			: base(message, inner)
		{
		}

		public PermissionException(string operateUserName, object operateObject, Guid operationResourceId, int operationPermissionCode)
		{
			this.OperateUserName = operateUserName;
			this.OperateObject = operateObject;
			this.OperationResourceId = operationResourceId;
			this.OperationPermissionCode = operationPermissionCode;
		}

		public PermissionException(string operateUserName, object operateObject, Guid operationResourceId, int operationPermissionCode, string message)
			: base(message)
		{
			this.OperateUserName = operateUserName;
			this.OperateObject = operateObject;
			this.OperationResourceId = operationResourceId;
			this.OperationPermissionCode = operationPermissionCode;
		}
	}
}